package com.stu.spring.context.chapter09.mybatis.demo;

import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.InputStream;

public class MyBatisUtil {

	private final static SqlSessionFactory SQL_SESSION_FACTORY;

	static {
		InputStream resourceAsStream = MyBatisUtil.class.getClassLoader().getResourceAsStream("chapter09/mybatis-config.xml");

		SQL_SESSION_FACTORY = new SqlSessionFactoryBuilder().build(resourceAsStream);
	}

	public static SqlSessionFactory getSqlSessionFactory() {
		return SQL_SESSION_FACTORY;
	}
}
